﻿<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>会员查询</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/Pager.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/header&footer.js"></script>
<script type="text/javascript" src="js/jquery.pager.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
</head>
<script type="text/javascript">
var paramStr=location.search;
var openId = "openId";
var shopId = "shopId";
openId = getWxParameter(openId,paramStr);
shopId = getWxParameter(shopId,paramStr);
var pagecount = 0;
var count = 0;
var pageIndex = 1 ;
$(function() {
	InitTable(openId,shopId);
});
function getBoxHtml(data){
	if(IsEmpty(data)){
		return;
	}
	var rst = JSON.parse(data);
	var status=null;
	var CreateTime = null;
	var SaleName = null;//服务项
	var ReceAmt = null;
	var boxHtml = "";
	for(var i=0;i<rst.result.data.length;i++){
		$("#funcMenuList tbody").append("<tr></tr>");
		status = rst.state;
		CreateTime = getHtmlString(getHeadIndexValue(i,rst,"CreateTime"));	
		SaleName = getHtmlString(getHeadIndexValue(i,rst,"ScheduleTypeName"));			
		ReceAmt = getHtmlInt(getHeadIndexValue(i,rst,"ReceAmt"));			
		if(IsNotEmpty(status) && status == 0){
			boxHtml = "<td id='createtime"+i+"'>"+getHtmlString(CreateTime)+"</td>"
			  boxHtml+="<td id='SaleName"+i+"'>"+getHtmlString(SaleName)+"</td>"
			  boxHtml+="<td id='ReceAmt"+i+"'>"+"￥"+getHtmlInt(ReceAmt)+"</td>"
			  $("#funcMenuList tbody tr:last").append(boxHtml)
		}else{
			boxHtml = "<td id='createtime"+i+"'>"+getHtmlString(CreateTime)+"</td>"
			  boxHtml+="<td id='SaleName"+i+"'>"+getHtmlString(SaleName)+"</td>"
			  boxHtml+="<td id='ReceAmt"+i+"'>"+"￥"+getHtmlInt(ReceAmt)+"</td>"
			$("#funcMenuList tbody tr:last").append(boxHtml);
		}
	}
}
function InitTable(openId,shopId) {
    var page=pageIndex-1;
    $("#funcMenuList tbody tr").remove();
	$.ajax({
		type : "post",
		async: false,
		data :{"openId":openId},
		datatype : "json",
		url : "../bussBill/find/payHistory/shopId/"+shopId+"/" + page + "/10",
		success : function(data) {
			if(IsNotEmpty(data)){
				getBoxHtml(data);
			}
			var rst = JSON.parse(data);
			if(rst.result.len > 0){
				 var shu = rst.result.len;
			 	 pagecount = Math.ceil(shu/10);
			}else{
				pagecount=0;
			}
			 $("#sup").html("共"+rst.result.len+"条");	
			 $("#pager").pager({ pagenumber: pageIndex, pagecount: pagecount, buttonClickCallback: PageClick });
		}
	});
}
PageClick = function(pageclickednumber) {
	pageIndex=pageclickednumber;
	InitTable(openId,shopId);
}
</script>
<body>
<div class="wrapper" id="wrapper">
<div class="placeTit"><a class="back" href="javascript:history.go(-1)"></a>消费查询</div>
    <div class="container">
	<!--<div class="onlyImg"><img src="images/onlyImg.jpg"></div>-->
    <table class="commonBtn" id="funcMenuList" width="100%" cellpadding="0" cellspacing="1" border="0" >
        <caption> 
                                     消费记录列表 <span id="sup">共0条</span>
        </caption>
    	<thead>
        	<tr>
            	<th>时间</th>
            	<th>消费类型</th>
            	<th>消费金额</th>
            </tr>
        </thead>
        <tbody id="tbody">
        </tbody>
    </table>
    </div>
</div>
<center ><div id="pager" ></div></center>
</body>
</html>
